/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.promotion;

import com.enation.app.javashop.client.promotion.PromotionGoodsClient;
import com.enation.app.javashop.core.client.fallback.promotion.PromotionGoodsClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.promotion.fulldiscount.vo.FullDiscountVO;
import com.enation.app.javashop.model.promotion.halfprice.vo.HalfPriceVO;
import com.enation.app.javashop.model.promotion.minus.vo.MinusVO;
import com.enation.app.javashop.model.promotion.seckill.dos.SeckillApplyDO;
import com.enation.app.javashop.model.promotion.tool.dos.PromotionGoodsDO;
import com.enation.app.javashop.model.promotion.tool.dto.PromotionDTO;
import com.enation.app.javashop.model.promotion.tool.vo.PromotionVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 促销商品fegin实现
 *
 * @author zh
 * @version v7.0
 * @date 19/5/27 下午6:42
 * @since v7.0
 */
@FeignClient(name = "promotion-service",fallbackFactory = PromotionGoodsClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface PromotionGoodsClientFeginImpl extends PromotionGoodsClient {
    /**
     * 删除促销活动商品
     *
     * @param goodsId    商品id
     * @param type       活动类型
     * @param activityId 活动id
     */
    @Override
    @RequestMapping(value = "/client/trade/promotion/goods", method = RequestMethod.DELETE)
    void delPromotionGoods(@RequestParam("goods_id") Long goodsId, @RequestParam("type") String type, @RequestParam("activity_id") Long activityId);

    /**
     * 删除促销活动商品
     *
     * @param delSkuIds
     */
    @Override
    @RequestMapping(value = "/client/trade/promotion/goods/skuids", method = RequestMethod.DELETE)
    void delPromotionGoods(@RequestBody List<Long> delSkuIds);


    /**
     * 根据商品id读取商品参与的所有活动（有效的活动）
     *
     * @param goodsId
     * @return 返回活动的集合
     */
    @Override
    @RequestMapping(value = "/client/trade/promotion/goods/{goods_id}", method = RequestMethod.GET)
    List<PromotionVO> getPromotion(@PathVariable("goods_id") Long goodsId);

    @Override
    @RequestMapping(value = "/client/trade/promotion/seckill/rollback-stock", method = RequestMethod.POST)
    void rollbackSeckillStock(@RequestBody List<PromotionDTO> promotionDTOList);

    @Override
    @RequestMapping(value = "/client/trade/promotion/seckill/add-sold-num", method = RequestMethod.POST)
    boolean addSeckillSoldNum(@RequestBody List<PromotionDTO> promotionDTOList);

    @Override
    @RequestMapping(value = "/client/trade/promotion/seckill/{seckill_id}/seckill-apply", method = RequestMethod.GET)
    List<SeckillApplyDO> getSeckillGoodsList(@PathVariable("seckill_id") Long seckillId, @RequestParam("status") String status);

    @Override
    @RequestMapping(value = "/client/trade/promotion/groupbuy/{order_sn}/rollback-stock", method = RequestMethod.POST)
    void rollbackGroupbuyStock(@RequestBody List<PromotionDTO> promotionDTOList, @PathVariable("order_sn") String orderSn);

    @Override
    @RequestMapping(value = "/client/trade/promotion/groupbuy/{order_sn}/cut-stock", method = RequestMethod.POST)
    boolean cutGroupbuyQuantity(@PathVariable("order_sn") String orderSn, @RequestBody List<PromotionDTO> promotionDTOList);

    @Override
    @RequestMapping(value = "/client/trade/promotion/groupbuy/goods-info/{goods_ids}", method = RequestMethod.POST)
    void updateGroupbuyGoodsInfo(@PathVariable("goods_ids") Long[] goodsIds);

    @Override
    @RequestMapping(value = "/client/trade/promotion/groupbuy/renew-buy-num", method = RequestMethod.POST)
    boolean renewGroupbuyBuyNum(@RequestParam("goodsid") Long goodid, @RequestParam("num") Integer num, @RequestParam("product_id") Long productId);

    @Override
    @RequestMapping(value = "/client/trade/promotion/groupbuy/{order_sn}/add-stock", method = RequestMethod.POST)
    void addGroupbuyQuantity(@PathVariable("order_sn") String orderSn);

    @Override
    @RequestMapping(value = "/client/trade/promotion/activity/{activity_id}/goods", method = RequestMethod.GET)
    List<PromotionGoodsDO> getPromotionGoods(@PathVariable("activity_id") Long activityId, @RequestParam("promotion_type") String promotionType);

    @Override
    @RequestMapping(value = "/client/trade/promotion/full-discount/{id}", method = RequestMethod.GET)
    FullDiscountVO getFullDiscountModel(@PathVariable("id") Long fdId);

    @Override
    @RequestMapping(value = "/client/trade/promotion/minus/{minus_id}", method = RequestMethod.GET)
    MinusVO getMinusFromDB(@PathVariable("minus_id") Long minusId);

    @Override
    @RequestMapping(value = "/client/trade/promotion/half-price/{id}", method = RequestMethod.GET)
    HalfPriceVO getHalfPriceFromDB(@PathVariable("id") Long id);

    @Override
    @GetMapping("/client/trade/promotion/goods-list")
    List<PromotionGoodsDO> getPromotionGoodsList(@RequestParam("promotion_type") String promotionType, @RequestParam("now_time") Long nowTime);

    @Override
    @PostMapping("/client/trade/promotion/{pg_id}/end-time")
    void updatePromotionEndTime(@RequestParam("end_time") Long endTime, @PathVariable("pg_id") Long pgId);

    @Override
    @PutMapping("/client/trade/promotion/exchange-goods-time")
    void updateExchangeGoodsTime(@RequestParam("goods_id") Long goodsId, @RequestParam("start_time") Long startTime, @RequestParam("end_time") Long endTime);


}
